package com.aspose.cells;

class zhb implements ICustomParser {
   private zath a = new zath();
   private StringBuilder b = new StringBuilder(50);
   private StringBuilder c = new StringBuilder(10);
   private zxx d;
   private com.aspose.cells.a.a.za e;
   private zahk f;
   private zate g;
   private int[] h = new int[3];
   private int[] i = new int[3];
   private int[] j = new int[3];
   private String[] k = new String[3];
   private int l = -1;
   private int m = -1;
   private int n = -1;
   private int o = -1;
   private int p = -1;
   private int q = -1;
   private int r = -1;
   private int s;
   private int t;
   private int u;
   private int v;
   private char[] w;

   public zhb(zate var1) {
      this.g = var1;
      this.d = var1.a();
      this.e = this.d.f();
      this.f = var1.c();
      if (this.f == null) {
         this.f = new zhn(var1);
      }

   }

   public Object parseObject(String value) {
      this.b.setLength(0);
      this.a.c();
      if (value != null && !"".equals(value)) {
         this.w = value.toCharArray();
         if (this.w[0] == ' ') {
            return null;
         } else {
            this.t = 0;
            this.u = this.w.length;
            this.v = 0;
            this.b();
            this.l = -1;
            this.m = -1;
            this.n = -1;
            this.o = -1;
            this.p = -1;
            this.q = -1;
            this.r = -1;
            this.v = this.t;
            int var2 = 0;
            int var3 = 0;
            int var5 = 0;
            int var6 = 0;
            boolean var7 = false;
            boolean var8 = false;
            boolean var9 = false;
            boolean var10 = false;
            byte var11 = 0;

            while(true) {
               label908:
               while(true) {
                  while(true) {
                     int var14;
                     if (this.v < this.u) {
                        label1034: {
                           char var4 = this.w[this.v];
                           if (var4 >= '0' && var4 <= '9') {
                              if ((!var9 || !var10) && this.s <= 2 && (this.s <= 0 || this.v - var5 <= (!var7 && (this.l <= -1 || this.l >= this.s) ? 3 : 1)) && (var9 || this.m != this.s)) {
                                 var2 = var2 * 10 + (var4 - 48);
                                 if (var7) {
                                    if (this.s > 0 && var2 > 60) {
                                       return null;
                                    }
                                 } else if (var2 > 9999) {
                                    return null;
                                 }

                                 ++this.v;
                                 continue;
                              }

                              return null;
                           }

                           zatg var12;
                           boolean var13;
                           if (var5 < this.v) {
                              if (!var9 || !var10) {
                                 var12 = this.f.a(this.w, this.v, var2);
                                 var13 = true;
                                 if (var12 != null) {
                                    switch(var12.a) {
                                    case 8:
                                    case 16:
                                    case 32:
                                       var13 = false;
                                       break;
                                    default:
                                       var13 = true;
                                    }
                                 } else {
                                    if (!var9) {
                                       var3 = this.f.c(this.w, this.v);
                                       if (var3 > 0) {
                                          var13 = true;
                                          var12 = new zatg();
                                          var12.f = this.v + var3;
                                          if (var2 > 100) {
                                             if (this.v - var5 < 4) {
                                                return null;
                                             }

                                             var12.a = 1;
                                          } else if (var2 > 31) {
                                             var12.a = 1;
                                          } else if (var2 > 12) {
                                             if (this.l > -1 && this.l < this.s) {
                                                var12.a = 1;
                                             } else {
                                                var12.a = 0;
                                             }
                                          } else if (this.l > -1 && this.l < this.s && this.n > -1 && this.n < this.s) {
                                             var12.a = 1;
                                          } else {
                                             var12.a = 0;
                                          }
                                       }
                                    }

                                    if (var12 == null && !var10) {
                                       var3 = this.f.d(this.w, this.v);
                                       if (var3 > 0) {
                                          var13 = false;
                                          var12 = new zatg();
                                          var12.a = 0;
                                          var12.f = this.v + var3;
                                       }
                                    }
                                 }

                                 if (var12 != null) {
                                    if (var13) {
                                       if (var9) {
                                          return null;
                                       }

                                       if (var7) {
                                          if (this.s <= 1) {
                                             return null;
                                          }

                                          if (var8) {
                                             this.b(var6, var5);
                                          } else {
                                             this.a(true);
                                          }

                                          if (this.p < 0) {
                                             return null;
                                          }

                                          this.a(this.j[this.s - 1], var5, false);
                                          var7 = false;
                                          var10 = true;
                                          this.b();
                                          var6 = var5;
                                          var8 = false;
                                       }
                                    } else {
                                       if (var10) {
                                          return null;
                                       }

                                       if (this.v - var5 > 2 && this.w[var5] == '0') {
                                          return null;
                                       }

                                       if (!var7) {
                                          if (this.s > 1) {
                                             if (var9) {
                                                return null;
                                             }

                                             if (var8) {
                                                this.a(var6, var5);
                                             } else {
                                                this.g();
                                             }

                                             if (this.m < 0) {
                                                return null;
                                             }

                                             this.a(this.j[this.s - 1], var5, false);
                                             var9 = true;
                                             this.b();
                                             var6 = var5;
                                             var8 = false;
                                          } else if (this.s > 0) {
                                             return null;
                                          }

                                          var7 = true;
                                       }
                                    }

                                    switch(var12.a) {
                                    case 1:
                                    case 128:
                                       if (this.l < 0) {
                                          this.l = this.s;
                                       } else if (this.l != this.s) {
                                          return null;
                                       }
                                       break;
                                    case 2:
                                       if (this.m < 0) {
                                          this.m = this.s;
                                       } else if (this.m != this.s) {
                                          return null;
                                       }
                                       break;
                                    case 4:
                                       if (this.n < 0) {
                                          this.n = this.s;
                                       } else if (this.n != this.s) {
                                          return null;
                                       }
                                       break;
                                    case 8:
                                       if (this.o < 0) {
                                          this.o = this.s;
                                       } else if (this.o != this.s) {
                                          return null;
                                       }
                                       break;
                                    case 16:
                                       if (this.p < 0) {
                                          this.p = this.s;
                                       } else if (this.p != this.s) {
                                          return null;
                                       }
                                       break;
                                    case 32:
                                       if (this.q < 0) {
                                          this.q = this.s;
                                       } else if (this.q != this.s) {
                                          return null;
                                       }
                                    }

                                    this.h[this.s] = var2;
                                    this.i[this.s] = var5;
                                    this.j[this.s] = this.v;
                                    ++this.s;
                                    this.v = var12.f;
                                    var5 = this.v;
                                    var2 = 0;
                                    continue;
                                 }
                              }

                              if (this.s > 2 || var9 && var10) {
                                 return null;
                              }

                              this.h[this.s] = var2;
                              this.i[this.s] = var5;
                              this.j[this.s] = this.v;
                              ++this.s;
                           }

                           if (var4 == ' ') {
                              for(var14 = this.v++; this.v < this.u && this.w[this.v] == ' '; ++this.v) {
                                 ;
                              }

                              var13 = false;
                              switch(this.s) {
                              case 0:
                                 this.a(var14, this.v, !var7);
                                 break;
                              case 1:
                                 if (var14 > var5 && this.v < this.u && this.w[this.v] >= '0' && this.w[this.v] <= '9') {
                                    return null;
                                 }
                                 break;
                              case 2:
                                 if (var14 > var5 && this.v < this.u && this.w[this.v] >= '0' && this.w[this.v] <= '9') {
                                    var13 = true;
                                 }
                                 break;
                              case 3:
                                 var13 = true;
                              }

                              if (var13) {
                                 if (!var8) {
                                    if (var7) {
                                       this.a(true);
                                       if (this.p < 0) {
                                          return null;
                                       }

                                       var7 = false;
                                       var10 = true;
                                    } else {
                                       this.g();
                                       if (this.m < 0) {
                                          return null;
                                       }

                                       var9 = true;
                                    }
                                 } else {
                                    if (!var7) {
                                       if (var9) {
                                          if (var10) {
                                             return null;
                                          }

                                          var7 = true;
                                       } else {
                                          var7 = !var10 && this.m < 0 && this.n < 0 && this.l < 0;
                                          this.a(var6, this.v);
                                          if (this.m < 0) {
                                             if (!var7) {
                                                return null;
                                             }
                                          } else {
                                             var9 = true;
                                             var7 = false;
                                          }
                                       }
                                    }

                                    if (var7) {
                                       this.b(var6, this.v);
                                       if (this.p < 0) {
                                          return null;
                                       }

                                       var7 = false;
                                       var10 = true;
                                    }
                                 }

                                 this.a(this.j[this.s - 1], this.v, false);
                                 this.b();
                                 var6 = this.v;
                                 var8 = false;
                              }

                              var5 = this.v;
                              var2 = 0;
                              continue;
                           }

                           if (!var9 || !var10) {
                              var12 = this.f.e(this.w, this.v);
                              if (var12 != null) {
                                 switch(var12.a) {
                                 case 1:
                                 case 2:
                                 case 4:
                                 case 128:
                                    if (var9) {
                                       return null;
                                    }

                                    if (var7) {
                                       if (this.s <= 1) {
                                          return null;
                                       }

                                       if (var8) {
                                          this.b(var6, this.v);
                                       } else {
                                          this.a(true);
                                       }

                                       if (this.p < 0) {
                                          return null;
                                       }

                                       this.a(this.j[this.s - 1], this.v + var3, false);
                                       var7 = false;
                                       var10 = true;
                                       this.b();
                                       var6 = this.v;
                                       var8 = false;
                                    }

                                    if (var12.a == 2) {
                                       if (this.m > -1) {
                                          return null;
                                       }

                                       this.m = this.s;
                                    } else if (var12.a == 4) {
                                       if (this.n > -1) {
                                          return null;
                                       }

                                       this.n = this.s;
                                    } else {
                                       if (this.l > -1) {
                                          return null;
                                       }

                                       this.l = this.s;
                                    }
                                    break;
                                 case 8:
                                 case 16:
                                 case 32:
                                    if (var10) {
                                       return null;
                                    }

                                    if (!var7) {
                                       if (this.s > 1) {
                                          if (var8) {
                                             this.a(var6, this.v);
                                          } else {
                                             this.g();
                                          }

                                          if (this.m < 0) {
                                             return null;
                                          }

                                          this.a(this.j[this.s - 1], this.v + var3, false);
                                          var9 = true;
                                          this.b();
                                          var6 = this.v;
                                          var8 = false;
                                       } else {
                                          if (this.s > 0) {
                                             return null;
                                          }

                                          this.a(this.v, this.v + var3, false);
                                       }

                                       var7 = true;
                                    }

                                    if (var12.a == 8) {
                                       if (this.o > -1) {
                                          return null;
                                       }

                                       this.o = this.s;
                                    } else if (var12.a == 16) {
                                       if (this.p > -1) {
                                          return null;
                                       }

                                       this.p = this.s;
                                    } else {
                                       if (this.q > -1) {
                                          return null;
                                       }

                                       this.q = this.s;
                                    }
                                    break;
                                 default:
                                    this.v = var12.f;
                                    continue;
                                 }

                                 this.i[this.s] = var12.d;
                                 this.h[this.s] = var12.b;
                                 this.k[this.s] = var12.c;
                                 ++this.s;
                                 this.v = var12.f;
                                 var5 = this.v;
                                 var2 = 0;
                                 continue;
                              }
                           }

                           if (var11 == 0) {
                              this.c.setLength(0);
                              var3 = this.f.a(this.w, this.v, this.c);
                              if (var3 > 0) {
                                 var11 = 1;
                              } else {
                                 var3 = this.f.b(this.w, this.v, this.c);
                                 if (var3 > 0) {
                                    var11 = 2;
                                 }
                              }

                              if (var3 > 0) {
                                 if (this.s > 1) {
                                    if (!var8) {
                                       if (var7) {
                                          this.a(true);
                                          if (this.p < 0) {
                                             return null;
                                          }

                                          var7 = false;
                                          var10 = true;
                                       } else {
                                          this.g();
                                          if (this.m < 0) {
                                             return null;
                                          }

                                          var9 = true;
                                       }
                                    } else {
                                       if (!var9 && !var7) {
                                          var7 = !var10 && this.m < 0 && this.n < 0 && this.l < 0;
                                          this.a(var6, this.v);
                                          if (this.m < 0) {
                                             if (!var7) {
                                                return null;
                                             }
                                          } else {
                                             var9 = true;
                                             var7 = false;
                                          }
                                       }

                                       if (var7) {
                                          this.b(var6, this.v);
                                          if (this.p < 0) {
                                             return null;
                                          }

                                          var7 = false;
                                          var10 = true;
                                       }
                                    }

                                    this.a(this.j[this.s - 1], this.v, false);
                                    this.b();
                                    var6 = this.v + var3;
                                    var8 = false;
                                 } else if (this.s > 0) {
                                    return null;
                                 }

                                 this.b.append(this.c);
                                 this.a.a(64);
                                 this.v += var3;
                                 var5 = this.v;
                                 var2 = 0;
                                 continue;
                              }
                           }

                           if (var7) {
                              if (var4 != '.' && var4 != this.e.d()) {
                                 var8 = true;
                                 ++this.v;
                                 var5 = this.v;
                                 var2 = 0;
                                 continue;
                              }

                              if (this.s >= 2 && this.v != var5 && var2 <= 60) {
                                 if (var8) {
                                    this.b(var6, this.v);
                                 } else {
                                    this.a(false);
                                 }

                                 if (this.p < 0) {
                                    return null;
                                 }

                                 var7 = false;
                                 var10 = true;
                                 this.b.append('.');
                                 this.b();
                                 ++this.v;
                                 var5 = this.v;

                                 for(var2 = 0; this.v < Math.min(this.u, var5 + 3); ++this.v) {
                                    var4 = this.w[this.v];
                                    if (var4 < '0' || var4 > '9') {
                                       break;
                                    }

                                    var2 = var2 * 10 + (var4 - 48);
                                 }

                                 if (this.v > var5) {
                                    switch(this.v - var5) {
                                    case 1:
                                       var2 *= 100;
                                       this.b.append('0');
                                       break;
                                    case 2:
                                       var2 *= 10;
                                       this.b.append("00");
                                       break;
                                    case 3:
                                       this.b.append("000");
                                    }

                                    this.r = var2;
                                    var2 = 0;
                                    var5 = this.v;
                                 }

                                 var6 = this.v;
                                 var8 = false;
                                 continue;
                              }

                              return null;
                           }

                           if (var9) {
                              return null;
                           }

                           if (var4 == ',' || var4 == this.e.e()) {
                              if (this.s == 2) {
                                 if (this.m < 0) {
                                    return null;
                                 }

                                 if (this.m >= this.s || this.j[this.m] - this.i[this.m] < 3) {
                                    return null;
                                 }

                                 this.n = 1 - this.m;
                              } else {
                                 if (this.s != 1) {
                                    return null;
                                 }

                                 if (this.m < 0) {
                                    this.n = 0;
                                    this.m = 1;
                                 } else if (this.m != 0) {
                                    return null;
                                 }
                              }

                              this.i[this.s] = this.v;

                              for(var14 = 0; var14 < this.s; ++var14) {
                                 for(int var16 = this.j[var14]; var16 < this.i[var14 + 1]; ++var16) {
                                    if (this.w[var16] != ' ') {
                                       return null;
                                    }
                                 }
                              }

                              if (this.n > -1 && this.n < this.s && (this.h[this.n] < 1 || this.h[this.n] > 31)) {
                                 return null;
                              }

                              ++this.v;
                              var5 = this.v;
                              var2 = 0;
                              continue;
                           }

                           if (this.s >= 3 || this.m >= 0 && this.m != this.s) {
                              break label908;
                           }

                           var3 = this.f.f(this.w, this.v);
                           if (var3 != 0) {
                              this.h[this.s] = (var3 >> 1 & Integer.MAX_VALUE) >> 27;
                              this.i[this.s] = this.v;
                              var3 &= 268435455;
                              this.v += var3;
                              this.j[this.s] = this.v;
                              if (this.v < this.u && this.w[this.v] == ' ') {
                                 while(true) {
                                    ++this.v;
                                    if (this.v >= this.u) {
                                       break;
                                    }

                                    if (this.w[this.v] != ' ') {
                                       if (!this.a(this.w[this.v])) {
                                          --this.v;
                                       }
                                       break;
                                    }
                                 }
                              }

                              if (this.v == this.u) {
                                 this.m = this.s++;
                                 var5 = this.v;
                                 var2 = 0;
                                 break label1034;
                              }

                              if (this.v < this.u) {
                                 if (this.a(this.w[this.v])) {
                                    this.m = this.s++;
                                    if (this.w[this.v] != ' ') {
                                       ++this.v;
                                    }

                                    var5 = this.v;
                                    var2 = 0;
                                    continue;
                                 }

                                 if (this.w[this.v] >= '0' && this.w[this.v] <= '9') {
                                    this.m = this.s++;
                                    var5 = this.v;
                                    var2 = 0;
                                    continue;
                                 }
                              }

                              this.v -= var3;
                           }

                           if (this.m == this.s) {
                              return null;
                           }
                           break label908;
                        }
                     }

                     if (this.s > 0) {
                        if (var9 && var10) {
                           return null;
                        }

                        if (this.v > var5) {
                           this.h[this.s] = var2;
                           this.i[this.s] = var5;
                           this.j[this.s] = this.v;
                           ++this.s;
                        }

                        if (this.s < 2) {
                           return null;
                        }

                        if (var8) {
                           if (!var9 && !var7) {
                              var7 = !var10 && this.m < 0 && this.n < 0 && this.l < 0;
                              this.a(var6, this.v);
                              if (this.m < 0) {
                                 if (!var7) {
                                    return null;
                                 }
                              } else {
                                 var9 = true;
                                 var7 = false;
                              }
                           }

                           if (var7) {
                              this.b(var6, this.v);
                              if (this.p < 0) {
                                 return null;
                              }

                              var7 = false;
                              var10 = true;
                           }
                        } else if (var7) {
                           this.a(true);
                           if (this.p < 0) {
                              return null;
                           }

                           var7 = false;
                           var10 = true;
                        } else {
                           if (var9) {
                              return null;
                           }

                           if (this.l < 0) {
                              for(var14 = this.j[this.s - 1]; var14 < this.v; ++var14) {
                                 if (this.w[var14] == ',' || this.w[var14] == this.e.e()) {
                                    return null;
                                 }
                              }
                           }

                           this.g();
                           if (this.m < 0) {
                              return null;
                           }

                           var9 = true;
                        }

                        this.a(this.j[this.s - 1], this.v, false);
                     } else if (this.v > var5) {
                        return null;
                     }

                     if ((var11 & 255) > 0) {
                        if (this.p < 0 || this.o < 0 || this.o > 12) {
                           return null;
                        }

                        if (var11 == 1) {
                           if (this.o == 12) {
                              this.o = 0;
                           }
                        } else if (this.o < 12) {
                           this.o += 12;
                        }
                     }

                     if (this.m < 0) {
                        if (this.p < 0) {
                           return null;
                        }

                        double var15 = 0.0D;
                        if (this.o > -1) {
                           var15 = (double)this.o;
                        }

                        var15 += (double)this.p / 60.0D;
                        if (this.q > -1) {
                           var15 += (double)this.q / 3600.0D;
                        }

                        if (this.r > -1) {
                           var15 += (double)this.r / 3600000.0D;
                        }

                        this.a.a(zbtq.a(var15 / 24.0D, false));
                     } else if (this.o > 23) {
                        DateTime var17 = new DateTime(this.l, this.m, this.n > -1 ? this.n : 1, 0, this.p > -1 ? this.p : 0, this.q > -1 ? this.q : 0, this.r > -1 ? this.r : 0);
                        this.a.a(var17.addHours((double)this.o));
                     } else {
                        this.a.a(new DateTime(this.l, this.m, this.n > -1 ? this.n : 1, this.o > -1 ? this.o : 0, this.p > -1 ? this.p : 0, this.q > -1 ? this.q : 0, this.r > -1 ? this.r : 0));
                     }

                     this.a.a(com.aspose.cells.b.a.zr.a(this.b));
                     return this.a.d();
                  }
               }

               if (var8) {
                  if (this.v - (this.s > 0 ? this.j[this.s - 1] : this.t) > 20) {
                     return null;
                  }
               } else {
                  var8 = true;
               }

               ++this.v;
               var5 = this.v;
               var2 = 0;
            }
         }
      } else {
         return null;
      }
   }

   public zati a() {
      return this.a;
   }

   private void b() {
      this.s = 0;
      this.k[0] = null;
      this.k[1] = null;
      this.k[2] = null;
   }

   private void a(int var1, int var2, boolean var3) {
      if (var1 != var2) {
         boolean var4 = this.b.length() > 0 && this.b.charAt(this.b.length() - 1) == '"';
         if (var4) {
            this.b.setLength(this.b.length() - 1);
         }

         while(var1 < var2) {
            switch(this.w[var1]) {
            case ' ':
            case ',':
            case '-':
            case '.':
            case ':':
               if (var4) {
                  this.b.append('"');
                  var4 = false;
               }
               break;
            case '/':
               if (var3 && this.w[var1] != this.e.g()) {
                  if (!var4) {
                     this.b.append('\\');
                  }
               } else if (var4) {
                  this.b.append('"');
                  var4 = false;
               }
               break;
            default:
               if (!var4) {
                  this.b.append('"');
                  var4 = true;
               }
            }

            this.b.append(this.w[var1]);
            ++var1;
         }

         if (var4) {
            this.b.append('"');
         }

      }
   }

   private void a(int var1, boolean var2) {
      if (var1 < this.s - 1) {
         this.a(this.j[var1], this.i[var1 + 1], var2);
      }

   }

   private void a(boolean var1) {
      if (this.s > 2) {
         if (this.o < 0) {
            if (this.p > -1 || this.q > -1) {
               this.p = -1;
               return;
            }

            this.o = 0;
            this.p = 1;
            this.q = 2;
         } else if (this.p < 0 || this.q < 0) {
            this.p = -1;
            return;
         }
      } else {
         if (this.s <= 1) {
            this.p = -1;
            return;
         }

         if (this.p < 0) {
            if (this.o >= 0) {
               this.p = -1;
               return;
            }

            if (this.q >= 0) {
               this.p = -1;
               return;
            }

            if (var1) {
               this.o = 0;
               this.p = 1;
            } else {
               this.p = 0;
               this.q = 1;
            }
         } else if (this.o < 0 && this.q < 0) {
            this.p = -1;
            return;
         }
      }

      this.c();
      if (this.p >= 0) {
         int var2 = 0;
         this.p = this.h[this.p];
         if (this.p == 60) {
            ++var2;
         }

         if (this.o > -1) {
            this.o = this.h[this.o];
            if (this.o == 60) {
               ++var2;
            }
         }

         if (this.q > -1) {
            this.q = this.h[this.q];
            if (this.q == 60) {
               ++var2;
            }
         }

         if (var2 > 1) {
            this.p = -1;
         }
      }
   }

   private void c() {
      switch(this.o) {
      case 0:
         switch(this.p) {
         case 1:
            if (this.q > -1 && this.q != 2) {
               this.p = -1;
               return;
            }

            this.d();
            this.e();
            this.f();
            return;
         case 2:
            if (this.q != 1) {
               this.p = -1;
               return;
            }

            this.d();
            this.f();
            this.e();
            return;
         default:
            this.p = -1;
            return;
         }
      case 1:
         switch(this.p) {
         case 0:
            if (this.q > -1 && this.q != 2) {
               this.p = -1;
               return;
            }

            this.e();
            this.d();
            this.f();
            return;
         case 2:
            if (this.q != 0) {
               this.p = -1;
               return;
            }

            this.f();
            this.d();
            this.e();
            return;
         default:
            this.p = -1;
            return;
         }
      default:
         switch(this.p) {
         case 0:
            if (this.q != 1) {
               this.p = -1;
               return;
            }

            this.e();
            this.f();
            this.d();
            break;
         case 1:
            if (this.q != 0) {
               this.p = -1;
               return;
            }

            this.f();
            this.e();
            this.d();
            break;
         default:
            this.p = -1;
            return;
         }
      }

   }

   private void d() {
      if (this.o >= 0) {
         this.a.a(8);
         if (this.k[this.o] != null) {
            this.b.append(this.k[this.o]);
         } else {
            if (this.h[this.o] > 23) {
               this.b.append("[h]");
            } else if (this.h[this.o] < 10 && this.j[this.o] - this.i[this.o] > 1) {
               this.b.append("hh");
            } else {
               this.b.append('h');
            }

            this.a(this.o, false);
         }
      }
   }

   private void e() {
      this.a.a(16);
      if (this.k[this.p] != null) {
         this.b.append(this.k[this.p]);
      } else {
         if (this.j[this.p] - this.i[this.p] <= 1 || this.h[this.p] >= 10 && (this.q <= -1 || this.h[this.q] >= 10 || this.j[this.q] - this.i[this.q] <= 1)) {
            this.b.append('m');
         } else {
            this.b.append("mm");
         }

         this.a(this.p, false);
      }
   }

   private void f() {
      if (this.q >= 0) {
         this.a.a(32);
         if (this.k[this.q] != null) {
            this.b.append(this.k[this.q]);
         } else {
            if (this.j[this.q] - this.i[this.q] <= 1 || this.h[this.q] >= 10 && (this.p <= -1 || this.h[this.p] >= 10 || this.j[this.p] - this.i[this.p] <= 1)) {
               this.b.append('s');
            } else {
               this.b.append("ss");
            }

            this.a(this.q, false);
         }
      }
   }

   private void g() {
      if (this.s >= 2) {
         if (this.s > 2 && this.g.e()) {
            switch(this.e.f()) {
            case 2:
               if (this.m < 0) {
                  this.m = 0;
               } else if (this.m != 0) {
                  this.m = -1;
                  return;
               }

               if (this.n < 0) {
                  this.n = 1;
               } else if (this.n != 1) {
                  this.m = -1;
                  return;
               }

               if (this.l < 0) {
                  this.l = 2;
               } else if (this.l != 2) {
                  this.m = -1;
                  return;
               }

               if (this.l() && this.m() && this.n()) {
                  this.p();
                  this.q();
                  this.o();
                  break;
               }

               this.m = -1;
               return;
            case 3:
               if (this.n < 0) {
                  this.n = 0;
               } else if (this.n != 0) {
                  this.m = -1;
                  return;
               }

               if (this.m < 0) {
                  this.m = 1;
               } else if (this.m != 1) {
                  this.m = -1;
                  return;
               }

               if (this.l < 0) {
                  this.l = 2;
               } else if (this.l != 2) {
                  this.m = -1;
                  return;
               }

               if (this.l() && this.m() && this.n()) {
                  this.q();
                  this.p();
                  this.o();
                  break;
               }

               this.m = -1;
               return;
            case 4:
               if (this.l < 0) {
                  this.l = 0;
               } else if (this.l != 0) {
                  this.m = -1;
                  return;
               }

               if (this.m < 0) {
                  this.m = 1;
               } else if (this.m != 1) {
                  this.m = -1;
                  return;
               }

               if (this.n < 0) {
                  this.n = 2;
               } else if (this.n != 2) {
                  this.m = -1;
                  return;
               }

               if (!this.l() || !this.m() || !this.n()) {
                  this.m = -1;
                  return;
               }

               this.o();
               this.p();
               this.q();
               break;
            case 5:
               if (this.l < 0) {
                  this.l = 0;
               } else if (this.l != 0) {
                  this.m = -1;
                  return;
               }

               if (this.n < 0) {
                  this.n = 1;
               } else if (this.n != 1) {
                  this.m = -1;
                  return;
               }

               if (this.m < 0) {
                  this.m = 2;
               } else if (this.m != 2) {
                  this.m = -1;
                  return;
               }

               if (!this.l() || !this.m() || !this.n()) {
                  this.m = -1;
                  return;
               }

               this.o();
               this.q();
               this.p();
               break;
            case 6:
               if (this.m < 0) {
                  this.m = 0;
               } else if (this.m != 0) {
                  this.m = -1;
                  return;
               }

               if (this.l < 0) {
                  this.l = 1;
               } else if (this.l != 1) {
                  this.m = -1;
                  return;
               }

               if (this.n < 0) {
                  this.n = 2;
               } else if (this.n != 2) {
                  this.m = -1;
                  return;
               }

               if (!this.l() || !this.m() || !this.n()) {
                  this.m = -1;
                  return;
               }

               this.p();
               this.o();
               this.q();
               break;
            case 7:
               if (this.n < 0) {
                  this.n = 0;
               } else if (this.n != 0) {
                  this.m = -1;
                  return;
               }

               if (this.l < 0) {
                  this.l = 1;
               } else if (this.l != 1) {
                  this.m = -1;
                  return;
               }

               if (this.m < 0) {
                  this.m = 2;
               } else if (this.m != 2) {
                  this.m = -1;
                  return;
               }

               if (!this.l() || !this.m() || !this.n()) {
                  this.m = -1;
                  return;
               }

               this.q();
               this.o();
               this.p();
               break;
            default:
               this.m = -1;
               return;
            }
         } else {
            int var1;
            if (this.l < 0) {
               for(var1 = 0; var1 < this.s; ++var1) {
                  if (this.h[var1] > 31) {
                     this.l = var1;
                     break;
                  }
               }
            }

            if (this.n < 0 && this.l > -1) {
               for(var1 = 0; var1 < this.s; ++var1) {
                  if (var1 != this.l && this.h[var1] > 12) {
                     this.n = var1;
                     break;
                  }
               }
            }

            if (this.s == 2) {
               switch(this.l) {
               case 0:
                  this.m = 1;
                  if (this.l() && this.m()) {
                     this.o();
                     this.p();
                     break;
                  }

                  this.m = -1;
                  return;
               case 1:
                  this.m = 0;
                  if (!this.l() || !this.m()) {
                     this.m = -1;
                     return;
                  }

                  this.p();
                  this.o();
                  break;
               default:
                  switch(this.m) {
                  case 0:
                     if (!this.m()) {
                        this.m = -1;
                        return;
                     }

                     if (this.n < 0) {
                        this.n = 1;
                        if (this.h() && this.n()) {
                           this.p();
                           this.q();
                        } else {
                           this.n = -1;
                           this.l = 1;
                           if (!this.l()) {
                              this.m = -1;
                              return;
                           }

                           this.p();
                           this.o();
                        }
                     } else {
                        if (!this.n()) {
                           this.m = -1;
                           return;
                        }

                        this.p();
                        this.q();
                     }
                     break;
                  case 1:
                     if (!this.m()) {
                        this.m = -1;
                        return;
                     }

                     if (this.n < 0) {
                        this.n = 0;
                        if (!this.h() && this.n()) {
                           this.q();
                           this.p();
                        } else {
                           this.n = -1;
                           this.l = 0;
                           if (!this.l()) {
                              this.m = -1;
                              return;
                           }

                           this.o();
                           this.p();
                        }
                     } else {
                        if (!this.n()) {
                           this.m = -1;
                           return;
                        }

                        this.q();
                        this.p();
                     }
                     break;
                  default:
                     switch(this.n) {
                     case 0:
                        this.m = 1;
                        if (!this.m() || !this.n()) {
                           this.m = -1;
                           return;
                        }

                        this.q();
                        this.p();
                        break;
                     case 1:
                        this.m = 0;
                        if (!this.m() || !this.n()) {
                           this.m = -1;
                           return;
                        }

                        this.p();
                        this.q();
                        break;
                     default:
                        this.m = this.h() ? 0 : 1;
                        this.n = 1 - this.m;
                        if (!this.m()) {
                           this.n = this.m;
                           this.m = 1 - this.n;
                           if (!this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        if (!this.n()) {
                           this.l = this.n;
                           this.n = -1;
                           if (!this.l()) {
                              this.m = -1;
                              return;
                           }

                           if (this.m == 0) {
                              this.p();
                              this.o();
                           } else {
                              this.o();
                              this.p();
                           }
                        } else if (this.m == 0) {
                           this.p();
                           this.q();
                        } else {
                           this.q();
                           this.p();
                        }
                     }
                  }
               }
            } else {
               boolean var2;
               switch(this.l) {
               case 0:
                  if (!this.l()) {
                     this.m = -1;
                     return;
                  }

                  var2 = true;
                  if (this.m < 0) {
                     if (this.n < 0) {
                        this.m = this.h() ? 1 : 2;
                        this.n = 3 - this.m;
                        if (!this.m()) {
                           this.n = this.m;
                           this.m = 3 - this.n;
                           if (!this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        if (!this.n()) {
                           this.m = -1;
                           return;
                        }

                        var2 = false;
                     } else {
                        this.m = 3 - this.n;
                     }
                  } else if (this.n < 0) {
                     this.n = 3 - this.m;
                  }

                  if (var2 && (!this.m() || !this.n())) {
                     this.m = -1;
                     return;
                  }

                  this.o();
                  if (this.m == 1) {
                     this.p();
                     this.q();
                  } else {
                     this.q();
                     this.p();
                  }
                  break;
               case 1:
                  if (!this.l()) {
                     this.m = -1;
                     return;
                  }

                  var2 = true;
                  if (this.m < 0) {
                     if (this.n < 0) {
                        this.m = this.h() ? 0 : 2;
                        this.n = 2 - this.m;
                        if (!this.m()) {
                           this.n = this.m;
                           this.m = 2 - this.n;
                           if (!this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        if (!this.n()) {
                           this.m = -1;
                           return;
                        }

                        var2 = false;
                     } else {
                        this.m = 2 - this.n;
                     }
                  } else if (this.n < 0) {
                     this.n = 2 - this.m;
                  }

                  if (var2 && (!this.m() || !this.n())) {
                     this.m = -1;
                     return;
                  }

                  if (this.m == 0) {
                     this.p();
                     this.o();
                     this.q();
                  } else {
                     this.q();
                     this.o();
                     this.p();
                  }
                  break;
               case 2:
                  if (!this.l()) {
                     this.m = -1;
                     return;
                  }

                  var2 = true;
                  if (this.m < 0) {
                     if (this.n < 0) {
                        this.m = this.h() ? 0 : 1;
                        this.n = 1 - this.m;
                        if (!this.m()) {
                           this.n = this.m;
                           this.m = 1 - this.n;
                           if (!this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        if (!this.n()) {
                           this.m = -1;
                           return;
                        }

                        var2 = false;
                     } else {
                        this.m = 1 - this.n;
                     }
                  } else if (this.n < 0) {
                     this.n = 1 - this.m;
                  }

                  if (var2 && (!this.m() || !this.n())) {
                     this.m = -1;
                     return;
                  }

                  if (this.m == 0) {
                     this.p();
                     this.q();
                  } else {
                     this.q();
                     this.p();
                  }

                  this.o();
                  break;
               default:
                  switch(this.m) {
                  case 0:
                     if (!this.m()) {
                        this.m = -1;
                        return;
                     }

                     var2 = true;
                     if (this.n < 0) {
                        if ((this.h[2] >= 10 || this.j[2] - this.i[2] != 1) && this.e.f() != 6) {
                           this.n = 1;
                        } else {
                           this.n = 2;
                        }

                        this.l = 3 - this.n;
                        if (!this.l()) {
                           this.m = -1;
                           return;
                        }

                        if (this.n()) {
                           var2 = false;
                        } else {
                           this.n = this.l;
                           this.l = 3 - this.n;
                        }
                     } else {
                        this.l = 3 - this.n;
                     }

                     if (var2 && (!this.l() || !this.n())) {
                        this.m = -1;
                        return;
                     }

                     this.p();
                     if (this.n == 1) {
                        this.q();
                        this.o();
                     } else {
                        this.o();
                        this.q();
                     }
                     break;
                  case 1:
                     if (!this.m()) {
                        this.m = -1;
                        return;
                     }

                     var2 = true;
                     if (this.n < 0) {
                        if (this.h[2] < 10 && this.j[2] - this.i[2] == 1) {
                           this.n = 2;
                        } else {
                           this.n = !this.i() && this.j[1] - this.i[1] <= 2 ? 2 : 0;
                        }

                        this.l = 2 - this.n;
                        if (!this.l()) {
                           this.m = -1;
                           return;
                        }

                        if (this.n()) {
                           var2 = false;
                        } else {
                           this.n = this.l;
                           this.l = 2 - this.n;
                        }
                     } else {
                        this.l = 2 - this.n;
                     }

                     if (var2 && (!this.l() || !this.n())) {
                        this.m = -1;
                        return;
                     }

                     if (this.n == 0) {
                        this.q();
                        this.p();
                        this.o();
                     } else {
                        this.o();
                        this.p();
                        this.q();
                     }
                     break;
                  case 2:
                     if (!this.m()) {
                        this.m = -1;
                        return;
                     }

                     var2 = true;
                     if (this.n < 0) {
                        this.n = this.i() ? 0 : 1;
                        this.l = 1 - this.n;
                        if (!this.l()) {
                           this.m = -1;
                           return;
                        }

                        if (this.n()) {
                           var2 = false;
                        } else {
                           this.n = this.l;
                           this.l = 1 - this.n;
                        }
                     } else {
                        this.l = 1 - this.n;
                     }

                     if (var2 && (!this.l() || !this.n())) {
                        this.m = -1;
                        return;
                     }

                     if (this.n == 0) {
                        this.q();
                        this.o();
                     } else {
                        this.o();
                        this.q();
                     }

                     this.p();
                     break;
                  default:
                     switch(this.n) {
                     case 0:
                        if ((this.h[2] >= 10 || this.j[2] - this.i[2] != 1) && this.e.f() != 7) {
                           this.m = 1;
                        } else {
                           this.m = 2;
                        }

                        this.l = 3 - this.m;
                        if (!this.l()) {
                           this.m = -1;
                           return;
                        }

                        if (!this.m()) {
                           this.l = this.m;
                           this.m = 3 - this.l;
                           if (!this.l() || !this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        this.q();
                        if (this.m == 1) {
                           this.p();
                           this.o();
                        } else {
                           this.o();
                           this.p();
                        }
                        break;
                     case 1:
                        if ((this.h[2] >= 10 || this.j[2] - this.i[2] != 1) && this.e.f() != 5) {
                           this.m = 1;
                        } else {
                           this.m = 2;
                        }

                        this.l = 2 - this.m;
                        if (!this.l()) {
                           this.m = -1;
                           return;
                        }

                        if (!this.m()) {
                           this.l = this.m;
                           this.m = 2 - this.l;
                           if (!this.l() || !this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        if (this.m == 0) {
                           this.p();
                           this.q();
                           this.o();
                        } else {
                           this.o();
                           this.q();
                           this.p();
                        }
                        break;
                     case 2:
                        if ((this.h[0] >= 10 || this.j[1] - this.i[0] != 1) && this.e.f() != 6) {
                           this.m = 1;
                        } else {
                           this.m = 0;
                        }

                        this.l = 1 - this.m;
                        if (!this.l()) {
                           this.m = -1;
                           return;
                        }

                        if (!this.m()) {
                           this.l = this.m;
                           this.m = 1 - this.l;
                           if (!this.l() || !this.m()) {
                              this.m = -1;
                              return;
                           }
                        }

                        if (this.m == 0) {
                           this.p();
                           this.o();
                        } else {
                           this.o();
                           this.p();
                        }

                        this.q();
                        break;
                     default:
                        this.r();
                        if (this.m < 0) {
                           return;
                        }
                     }
                  }
               }
            }
         }

         if (this.m >= 0) {
            this.m = this.h[this.m];
            if (this.n < 0) {
               this.n = 1;
            } else {
               this.n = this.h[this.n];
            }

            this.l = this.k();
         }
      }
   }

   private boolean h() {
      switch(this.e.f()) {
      case 3:
      case 5:
      case 7:
         return false;
      case 4:
      case 6:
      default:
         return true;
      }
   }

   private boolean i() {
      switch(this.e.f()) {
      case 4:
      case 5:
      case 6:
         return false;
      default:
         return true;
      }
   }

   private int j() {
      int var1 = this.h[this.m];
      if (var1 == 2) {
         return DateTime.a(this.k()) ? 29 : 28;
      } else {
         return var1 < 8 ? 30 + var1 % 2 : 31 - var1 % 2;
      }
   }

   private int k() {
      int var1;
      if (this.l < 0) {
         var1 = DateTime.g().getYear();
      } else {
         var1 = this.h[this.l];
         if (this.k[this.l] == null && this.j[this.l] - this.i[this.l] < 3) {
            var1 += this.g.b();
         }
      }

      return var1;
   }

   private boolean l() {
      switch(this.j[this.l] - this.i[this.l]) {
      case 2:
         return this.h[this.l] > -1;
      case 4:
         return this.h[this.l] > 1898;
      default:
         return this.k[this.l] != null;
      }
   }

   private boolean m() {
      return this.h[this.m] > 0 && this.h[this.m] < 13 && (this.j[this.m] - this.i[this.m] < 3 || this.w[this.i[this.m]] != '0' || this.k[this.m] != null);
   }

   private boolean n() {
      return this.h[this.n] > 0 && this.h[this.n] <= this.j() && (this.j[this.n] - this.i[this.n] < 3 || this.k[this.n] != null);
   }

   private void o() {
      this.a.a(1);
      if (this.k[this.l] != null) {
         this.b.append(this.k[this.l]);
      } else {
         if (this.j[this.l] - this.i[this.l] > 2) {
            this.b.append("yyyy");
         } else {
            this.b.append("yy");
         }

         this.a(this.l, true);
      }
   }

   private void p() {
      this.a.a(2);
      if (this.k[this.m] != null) {
         this.b.append(this.k[this.m]);
      } else {
         switch(this.j[this.m] - this.i[this.m]) {
         case 1:
            this.b.append('m');
            break;
         case 2:
            if (this.h[this.m] >= 10 && (this.n <= -1 || this.h[this.n] >= 10 || this.j[this.n] - this.i[this.n] <= 1)) {
               this.b.append('m');
            } else {
               this.b.append("mm");
            }
            break;
         case 3:
            this.b.append("mmm");
            break;
         default:
            this.b.append("mmmm");
         }

         this.a(this.m, true);
      }
   }

   private void q() {
      this.a.a(4);
      if (this.k[this.n] != null) {
         this.b.append(this.k[this.n]);
      } else {
         switch(this.j[this.n] - this.i[this.n]) {
         case 1:
            this.b.append('d');
            break;
         default:
            if (this.h[this.n] >= 10 && (this.m <= -1 || this.h[this.m] >= 10 || this.j[this.m] - this.i[this.m] != 2)) {
               this.b.append('d');
            } else {
               this.b.append("dd");
            }
         }

         this.a(this.n, true);
      }
   }

   private void r() {
      this.a(this.e.f());
      if (this.m <= -1) {
         switch(this.e.f()) {
         case 2:
            this.a((int)3);
            if (this.m > -1) {
               return;
            } else {
               this.a((int)4);
               if (this.m > -1) {
                  return;
               }

               this.a((int)5);
               return;
            }
         case 3:
            this.a((int)2);
            if (this.m > -1) {
               return;
            } else {
               this.a((int)4);
               if (this.m > -1) {
                  return;
               }

               this.a((int)5);
               return;
            }
         case 4:
            this.a((int)2);
            if (this.m > -1) {
               return;
            } else {
               this.a((int)3);
               if (this.m > -1) {
                  return;
               }

               this.a((int)5);
               return;
            }
         case 5:
            this.a((int)3);
            if (this.m > -1) {
               return;
            } else {
               this.a((int)4);
               if (this.m > -1) {
                  return;
               }

               this.a((int)2);
               return;
            }
         case 6:
            this.a((int)7);
            if (this.m > -1) {
               return;
            } else {
               this.a((int)3);
               if (this.m > -1) {
                  return;
               } else {
                  this.a((int)2);
                  if (this.m > -1) {
                     return;
                  } else {
                     this.a((int)4);
                     if (this.m > -1) {
                        return;
                     }

                     this.a((int)5);
                     return;
                  }
               }
            }
         case 7:
            this.a((int)6);
            if (this.m > -1) {
               return;
            } else {
               this.a((int)3);
               if (this.m > -1) {
                  return;
               } else {
                  this.a((int)2);
                  if (this.m > -1) {
                     return;
                  } else {
                     this.a((int)4);
                     if (this.m > -1) {
                        return;
                     }

                     this.a((int)5);
                     return;
                  }
               }
            }
         default:
         }
      }
   }

   private void a(int var1) {
      switch(var1) {
      case 2:
         this.m = 0;
         this.n = 1;
         this.l = 2;
         if (this.l() && this.m() && this.n()) {
            this.p();
            this.q();
            this.o();
            return;
         }

         this.m = -1;
         return;
      case 3:
         this.n = 0;
         this.m = 1;
         this.l = 2;
         if (this.l() && this.m() && this.n()) {
            this.q();
            this.p();
            this.o();
            return;
         }

         this.m = -1;
         return;
      case 4:
         this.l = 0;
         this.m = 1;
         this.n = 2;
         if (this.l() && this.m() && this.n()) {
            this.o();
            this.p();
            this.q();
            return;
         }

         this.m = -1;
         return;
      case 5:
         this.l = 0;
         this.n = 1;
         this.m = 2;
         if (this.l() && this.m() && this.n()) {
            this.o();
            this.q();
            this.p();
            return;
         }

         this.m = -1;
         return;
      case 6:
         this.m = 0;
         this.l = 1;
         this.n = 2;
         if (this.l() && this.m() && this.n()) {
            this.p();
            this.o();
            this.q();
            return;
         }

         this.m = -1;
         return;
      case 7:
         this.n = 0;
         this.l = 1;
         this.m = 2;
         if (this.l() && this.m() && this.n()) {
            this.q();
            this.o();
            this.p();
            return;
         }

         this.m = -1;
         return;
      default:
      }
   }

   private boolean a(char var1) {
      switch(var1) {
      case ' ':
      case ',':
      case '-':
      case '/':
         return true;
      default:
         return var1 == this.e.e();
      }
   }

   private void a(int var1, int var2) {
      this.m = -1;
   }

   private void b(int var1, int var2) {
      this.p = -1;
   }

   public String getFormat() {
      return this.a.e();
   }
}
